<?php
/**
 *RefundController
 * @author tan bing
 * @date 2021-11-15 17:51
 */


namespace Modules\Order\Http\Controllers\Admin;


use Illuminate\Http\Request;
use Modules\Order\Http\Controllers\Controller;
use Modules\Order\Services\Admin\OrderRefundServices;

class RefundController extends Controller
{

    /**
     * @var OrderRefundServices
     * @author tan bing
     */
    private OrderRefundServices $orderRefundServices;

    /**
     * RefundController constructor.
     * @param OrderRefundServices $orderRefundServices
     * @author tan bing
     * @date 2021-11-17 9:25
     */
    public function __construct(OrderRefundServices $orderRefundServices)
    {
        $this->orderRefundServices = $orderRefundServices;
    }

    /**
     * @return mixed
     * @throws \Throwable
     * @author tan bing
     * @date 2021-11-17 9:25
     */
    public function refundOrder()
    {
        try {
            $result = $this->orderRefundServices->refundOrder();
        } catch (\Exception $e) {
            return $this->failed($e->getMessage());
        }

        return $this->success($result);
    }
}